package com.tspark.tspark1.mapper;

import com.tspark.tspark1.zoo.pojo.dto.LoginDTO;
import com.tspark.tspark1.zoo.pojo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    @Insert("INSERT INTO user (username,password) VALUES (#{username},#{password})")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    void register(LoginDTO loginDTO);

    @Select("SELECT * FROM user WHERE username = #{username} and deleted = 0")
    User getUserByUsername(String username);
}
